package collection_homework;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

//泛型
public class Generic2 {
    public static void main(String[] args) {
        Collection<Point>c = new ArrayList<>();
        c.add(new Point(1,2));
        c.add(new Point(3,4));
        c.add(new Point(5,6));
        c.add(new Point(7,8));

        Iterator<Point> it = c.iterator();
        while (it.hasNext()){
            System.out.println(it.next());
        }
        for (Point p:c) {
            System.out.println(p);
        }

    }
}
